Hello Jacky's English grammer! <a href="?action=new">随机生成一套题目和答案</a>  <a href="?action=fresh">刷新</a><br>
<pre>
<?php
$currentdir=dirname(__FILE__);

# 执行perl脚本，生成一套新题
if($_GET['action']){
	if($_GET['action'] =="new"){
		
		system("$currentdir\/create_new.pl excescis.data.all.answer");
		
	}

}

# 输出当前目录的题目

$files=array();

if (false != ($handle = opendir (dirname(__FILE__)))) {
	$i=0;
	while ( false !== ($file = readdir ( $handle )) ) {
		//只显示 .questions 结尾的文件
		if (strpos($file,".questions")) {
			array_push($files,$file);
		}
	}
	//关闭句柄
	closedir ( $handle );
}
rsort($files);
foreach($files as $ff){
	print "<a href=".$ff.">".$ff."</a>";
			$afile=str_replace(".questions",".answer",$ff);
			print "    <a href=".$afile.">".$afile."</a>\n";
	
}


?>
</pre>